//
//  SDPhotoCommentCell.m
//  SKinDiary
//
//  Created by pcyang on 16/7/24.
//  Copyright © 2016年 tencent. All rights reserved.
//

#import "SDPhotoCommentCell.h"

@implementation SDPhotoCommentCell

-(void)layoutSubviews
{
    self.arrowLabel.right = kScreenWidth - 40;
    self.titleLabel.right = 65;
    self.subTitleLabel.left = self.titleLabel.right + 20;
    self.subTitleLabel.top =  (self.height - self.subTitleLabel.height)/2;
    self.titleLabel.top = self.subTitleLabel.top;
    self.arrowLabel.top = (self.height - self.arrowLabel.height)/2;
    self.subTitleLabel.width = kScreenWidth - self.subTitleLabel.left - 60;
}


-(void)setCellData:(NSString*)title subtitle:(NSString*)subtitle
{
    [super setCellData:title subtitle:subtitle];
    CGSize size = [subtitle sizeWithFont:[UIFont systemFontOfSize:13] constrainedToSize:CGSizeMake(kScreenWidth - 145,MAXFLOAT)];
    self.subTitleLabel.height = size.height;
    self.subTitleLabel.numberOfLines = 10;
    [self setNeedsLayout];
}

+(float)getRequiredCellHeight:(NSString*)commentStr
{
    __block float height = 0.0f;
    
    if (CHECK_VALID_STRING(commentStr)) {
        CGSize size = [commentStr sizeWithFont:[UIFont systemFontOfSize:13] constrainedToSize:CGSizeMake(kScreenWidth - 145,MAXFLOAT)];
        height = size.height + 2* kTagLeftPadding;
        return height;
    }
    
    return kPhotoDetailInfoCellHeight;
}
@end
